/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Slots;

import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.Toolkit;
import javax.swing.JPanel;

/**
 *
 * @author moncef
 */
public class Baton extends JPanel {

    private Console console;
    private Graphics2D g2d;
    int i = 0;
    private Slots.Animation.AnimationVictoire animBaton = new Slots.Animation.AnimationVictoire();
    public Image IMAGE_BATON1 = Toolkit.getDefaultToolkit().createImage("Images/Batons/Baton1.JPG");
    public Image IMAGE_BATON2 = Toolkit.getDefaultToolkit().createImage("Images/Batons/Baton2.JPG");
    public Image IMAGE_BATON3 = Toolkit.getDefaultToolkit().createImage("Images/Batons/Baton3.JPG");
    public Image IMAGE_BATON4 = Toolkit.getDefaultToolkit().createImage("Images/Batons/Baton4.JPG");
    public Image IMAGE_BATON5 = Toolkit.getDefaultToolkit().createImage("Images/Batons/Baton5.JPG");
    public Image IMAGE_BATON6 = Toolkit.getDefaultToolkit().createImage("Images/Batons/Baton6.JPG");
    public Image IMAGE_BATON7 = Toolkit.getDefaultToolkit().createImage("Images/Batons/Baton7.JPG");
    public Image IMAGE_BATON8 = Toolkit.getDefaultToolkit().createImage("Images/Batons/Baton8.JPG");
    public Image IMAGE_BATON9 = Toolkit.getDefaultToolkit().createImage("Images/Batons/Baton9.JPG");
    public Image IMAGE_BATON10 = Toolkit.getDefaultToolkit().createImage("Images/Batons/Baton10.JPG");
    public Image IMAGE_BATON11 = Toolkit.getDefaultToolkit().createImage("Images/Batons/Baton11.JPG");
    public Image IMAGE_BATON12 = Toolkit.getDefaultToolkit().createImage("Images/Batons/Baton12.JPG");
    public Image IMAGE_BATON13 = Toolkit.getDefaultToolkit().createImage("Images/Batons/Baton13.JPG");
    public Image IMAGE_BATON14 = Toolkit.getDefaultToolkit().createImage("Images/Batons/Baton14.JPG");
    public Image IMAGE_BATON15 = Toolkit.getDefaultToolkit().createImage("Images/Batons/Baton15.JPG");
    public Image IMAGE_BATON16 = Toolkit.getDefaultToolkit().createImage("Images/Batons/Baton16.JPG");
    public Image IMAGE_BATON17 = Toolkit.getDefaultToolkit().createImage("Images/Batons/Baton17.JPG");
    public Image IMAGE_BATON18 = Toolkit.getDefaultToolkit().createImage("Images/Batons/Baton18.JPG");
    public Image IMAGE_BATON19 = Toolkit.getDefaultToolkit().createImage("Images/Batons/Baton19.JPG");
    public Image IMAGE_BATON20 = Toolkit.getDefaultToolkit().createImage("Images/Batons/Baton20.JPG");
    public Image IMAGE_BATON21 = Toolkit.getDefaultToolkit().createImage("Images/Batons/Baton21.JPG");
    public Image IMAGE_BATON22 = Toolkit.getDefaultToolkit().createImage("Images/Batons/Baton22.JPG");
    public Image IMAGE_BATON23 = Toolkit.getDefaultToolkit().createImage("Images/Batons/Baton23.JPG");
    public Image IMAGE_BATON24 = Toolkit.getDefaultToolkit().createImage("Images/Batons/Baton24.JPG");
    public Image IMAGE_BATON25 = Toolkit.getDefaultToolkit().createImage("Images/Batons/Baton25.JPG");
    public Image IMAGE_BATON26 = Toolkit.getDefaultToolkit().createImage("Images/Batons/Baton26.JPG");
    public Image IMAGE_BATON27 = Toolkit.getDefaultToolkit().createImage("Images/Batons/Baton27.JPG");
    public Image IMAGE_BATON28 = Toolkit.getDefaultToolkit().createImage("Images/Batons/Baton28.JPG");
    public Image IMAGE_BATON29 = Toolkit.getDefaultToolkit().createImage("Images/Batons/Baton29.JPG");
    public Image IMAGE_BATON30 = Toolkit.getDefaultToolkit().createImage("Images/Batons/Baton30.JPG");
    public Image IMAGE_BATON31 = Toolkit.getDefaultToolkit().createImage("Images/Batons/Baton31.JPG");
    public Image IMAGE_BATON32 = Toolkit.getDefaultToolkit().createImage("Images/Batons/Baton32.JPG");
    public Image IMAGE_BATON33 = Toolkit.getDefaultToolkit().createImage("Images/Batons/Baton33.JPG");
    public Image IMAGE_BATON34 = Toolkit.getDefaultToolkit().createImage("Images/Batons/Baton34.JPG");
    public Image IMAGE_BATON35 = Toolkit.getDefaultToolkit().createImage("Images/Batons/Baton35.JPG");

    public Baton(Console console) {
        this.console = console;
        this.setOpaque(false);
    }

    public void start() {
        animBaton.start();
    }

    public void stop() {
        animBaton.interrupt();

    }

    @Override
    public void paint(Graphics g) {
        g2d = (Graphics2D) g;

        System.out.println(i);
        if (i == 0) {
            g.drawImage(IMAGE_BATON1, 530, 40, null);
        } else if (i == 1) {
            g.drawImage(IMAGE_BATON2, 530, 40, null);
        } else if (i == 2) {
            g.drawImage(IMAGE_BATON3, 530, 40, null);
        } else if (i == 3) {
            g.drawImage(IMAGE_BATON4, 530, 40, null);
        } else if (i == 4) {
            g.drawImage(IMAGE_BATON5, 530, 40, null);
        } else if (i == 5) {
            g.drawImage(IMAGE_BATON6, 530, 40, null);
        } else if (i == 6) {
            g.drawImage(IMAGE_BATON7, 530, 40, null);
        } else if (i == 7) {
            g.drawImage(IMAGE_BATON8, 530, 40, null);
        } else if (i == 8) {
            g.drawImage(IMAGE_BATON9, 530, 40, null);
        } else if (i == 9) {
            g.drawImage(IMAGE_BATON10, 530, 40, null);
        } else if (i == 10) {
            g.drawImage(IMAGE_BATON11, 530, 40, null);
        }
        System.out.println(i);

        if (i >= 0 && i < 10) {
            i++;
        }
    }
}
